#include<bits/stdc++.h>
using namespace std;

const int maxn = 2e7;
bool p[maxn+5];
vector<int> np;

int main()
{
	memset(p, true, sizeof p);
	for(long long i = 2;i <= maxn;i++)
	{
		if(p[i])
			for(long long j = i*i;j <= maxn;j += i)
				p[j] = 0;
	}
	for(int i = 2;i <= maxn;i++)
		if(p[i] && p[i+2])
			np.emplace_back(i);
			
	int n, x;
	cin>>n;
	while(n--)
	{
		cin>>x;
		printf("(%d,%d)\n", np[x-1], np[x-1]+2);
	}
	return 0;
}

